/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.agi.util.sound;

import javax.sound.sampled.AudioFormat;

/**
 *
 * @author Renato
 */
public class InputConfig implements InputMixerConfig, FornecedorAudioFormat {
    private float sampleRate;
    private int sampleSizeInBits;
    private int channels;
    private boolean signed;
    private boolean bigEndian;
    
    public InputConfig(){
        sampleRate=32768;
        sampleSizeInBits=8;
        channels=1;
        signed=true;
        bigEndian=true;
        this.createFormat();        
    }
    
    public void setSampleRate(float sample){
        this.sampleRate=sample;
    }
    
    @Override
    public float getSampleRate() {
        return sampleRate;
    }

    @Override
    public int getSampleSizeInBits() {
        return sampleSizeInBits;
    }

    @Override
    public int getChannels() {
        return channels;
    }

    @Override
    public boolean getSigned() {
        return signed;
    }

    @Override
    public boolean getBigEndian() {
        return bigEndian;
    }
    
    private AudioFormat audioFormat;
    
    private void createFormat(){
        this.audioFormat=new AudioFormat(sampleRate,sampleSizeInBits,channels,signed,bigEndian);
    }
    
    public void createAudioFormat(){
        this.createFormat();
    }
    
    @Override
    public AudioFormat getAudioFormat() {        
        return audioFormat;
    }
}
